<template>
	<div>

		<span>{{counter}}</span><button @click="increment()">{{val}}</button>
	</div>
</template>
<script>
export default {
	name: 'counterButton',
	props: ['counter'],
	data() {
		return {
			val: this.counter
		}
	},
	methods: {
		increment: function() {
			this.val += 1;
			this.$emit('increment');
			
			this.$bus.$emit('add-todo', this.val);
		}
	}
}
</script>